/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
* This library is developed and distributed for free usage,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * You can redistribute and/or modify it under the terms of the
 * Simplified BSD License
 *
 *
 *
 *
 *
 *
 * 
 * @Original Author: jin Chen
 * @date: Jan 19, 2005$
 * @version: 1.0
 */
package edu.psu.geovista.app.visualclassifier.classify.v2;

import edu.psu.geovista.app.visualclassifier.classify.v2.gui.LgToolTipPane;
import edu.psu.geovista.classification.Category2D;
import edu.psu.geovista.classification.CategoryItf;

import javax.swing.*;
import java.awt.*;

public class LgToolTip extends JToolTip {
    LgToolTipPane p=new LgToolTipPane();
    public static final int DISPLAY_TYPE_1D=1;
    public static final int DISPLAY_TYPE_2D=2;
    public static final Dimension SIZE_2D = new Dimension(200,100);
    public static final Dimension SIZE_1D = new Dimension(200,50);
    public LgToolTip() {
       
        this.setLayout(new BorderLayout());
        this.add(p);
       // this.setFont(new Font("Arial",Font.PLAIN ,16));
        this.setPreferredSize(SIZE_2D );
        //this.setOpaque(false);

    }

    public LgToolTip(Color[] rowColors,Color[] columnColors,CategoryItf ctg){
          this();
          setTooltip(rowColors,columnColors,ctg);


    }

    public void setTooltip(Color[] rowColors,Color[] columnColors,CategoryItf ctg){
          p.setTooltip(rowColors,columnColors,ctg);
           //this.setLayout(new BorderLayout()); 
           if(ctg instanceof Category2D){ //2D
               //this.setPreferredSize(SIZE_2D);
               this.p.arrangeLayout(DISPLAY_TYPE_2D);

           }
           else{//1D
               //this.setPreferredSize(SIZE_1D);
               this.p.arrangeLayout(DISPLAY_TYPE_1D);
           }
            // 
            Dimension psize = p.getPreferredSize();
            psize.setSize(psize.width +20, psize.height +10);
            this.setPreferredSize(psize);
    }

}
